//
//  MCTableViewCell.m
//  HM玉器街
//
//  Created by 李李善 on 16/8/30.
//  Copyright © 2016年 HM. All rights reserved.
//

#import "BaseTableViewCell.h"
#import "UIView+Base.h"
//#import "IQUIView+Hierarchy.h"
@implementation BaseTableViewCell

- (void)dealloc
{
    NSLog(@"%@ 这个类被强暴了",NSStringFromClass([self class]));

}


- (id)initWithStyle:(UITableViewCellStyle)style forViewController:(UIViewController *)ViewController reuseIdentifier:(NSString *)reuseIdentifier forDataSource:(id)dataSource forIndexPath:(NSIndexPath *)indexPath
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.opaque = YES;
//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            [self onAsInitAddView:self.contentView forViewController:ViewController forDataSource:dataSource AtIndexPath:indexPath];
//            dispatch_async(dispatch_get_main_queue(), ^{
//                // switch back to the main thread to update your UI
//            });
//        });
        
    }
    return self;
}




-(void)layoutSubviews
{
    [super layoutSubviews];
    
    CGRect frame = self.frame;
    
    if (self.layoutBlock) {
        self.layoutBlock(self.contentView,frame.origin,frame.size,self.center);
    }
    
}

- (BOOL)isEqualModel:(BaseModel *)model
{
    if (self.model !=model) {
        return NO;
    }
    return YES;
}

-(HLTextField *)textField
{
    if (!_textField) {
        
        HLTextField*textF = ({
            HLTextField*l=[ HLTextField new];
            [self.contentView addV:l];
            l;
        });
        _textField = textF;
        
        
    }
    return _textField;
}

-(HLTextView *)textView
{
    if (!_textView) {
        HLTextView*textV = ({
            HLTextView*l=[ HLTextView new];
            [self.contentView addV:l];
            l;
        });
        _textView = textV;
        
    }
    return _textView;
}

-(MCLabel *)detailLabel
{
    if (!_detailLabel) {
        MCLabel*textV = ({
            MCLabel*l=[MCLabel new];
            [self.contentView addV:l];
            l;
        });
        _detailLabel = textV;
        
    }
    return _detailLabel;
}



-(UIButton *)button
{
    if (!_button) {
        UIButton *button = ({
            UIButton *l= [UIButton buttonWithType:UIButtonTypeCustom];
            [self.contentView addV:l];
            l;
        });
        _button = button;
    }
    return _button;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
